package com.jim.jeecg.imvc.core.form;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullForm {
	
	public static ActionForm full(String formClass,HttpServletRequest request)
	{
		ActionForm actionForm=null;
		
		try {
			Class clazz = Class.forName(formClass);
			actionForm=(ActionForm)clazz.newInstance();
			Field[] fields=clazz.getDeclaredFields();
			for (Field field : fields) {
				field.setAccessible(true);
				if(!"serialVersionUID".equals(field.getName()))
				field.set(actionForm, request.getParameter(field.getName()));
				field.setAccessible(false);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("严重：Form 信息装载失败~");
		}
		
		return actionForm;
		
	}

}
